<?php
class RedisQueue
{
    const MAX_QUEUE_NUM = 100000000;
    const REACH_MAX_NUM = "REACH_MAX_NUM";

    public function push($queue_name, $key, $value)
    {
        $current_num = $this->incrementQueue($queue_name);
        $max_num     = $this->getQueueMaxNum($queue_name);
        $max_num     = $max_num ? $max_num : self::MAX_QUEUE_NUM;
        
        if ($current_num > $max_num)
        {
            return self::REACH_MAX_NUM;
        }

        $key = $queue_name."_".$key."_".$current_num;
        //set to redis

        return true;
    }

    public function pop($queue_name, $key)
    {
        //get from redis
        $num = $this->incrementQueuePopPositon();
    }

    /**
     * a counter for current position of a queue
     */
    private function incrementQueuePopPosition($queue_name)
    {
        return $num;
    }

    /**
     * a counter for queue num
     *
     */
    private function incrementQueue($queue_name)
    {
        //set to redis
        return $current_num;
    }

    public function view($queue_name, $start, $size)
    {

    }


    public function status()
    {

    }

    public function reset($queue_name)
    {
        $this->setQueueCurrentNum(0);
        $this->setQueueCurrentPosition(0);
    }

    private function getQueueCurrentNum()
    {
        
    }

    public function setQueueNum($queue_name, $num)
    {
        
    }

    private function setDayStartNum($queue_name, $num)
    {

    }

}
